package com.lagou.sort;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import java.io.IOException;
//将<k1,v1>(行偏移量，行值)  --> <k2,v2> (行值，1)
//<k1,v1>:表示<行偏移量，行值（用Text表示）>
//<k2,v2>:表示<行值LongWritabe类型，1>;
public class SortMapper extends Mapper<LongWritable, Text,LongWritable, LongWritable > {

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String str = value.toString();
        context.write(new LongWritable(Integer.parseInt(str)), new LongWritable(1));
    }

}
